package com.kabao.javafx.fontdemo;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.text.Font;
import javafx.stage.Stage;


public class FxWebFontApp extends Application {
    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        Label label = new Label("Hello 123!JavaFx");
        Font font = Font.loadFont("https://db.onlinewebfonts.com/t/0ed964b46cdfeeff9e07717b9285bd7f.ttf", 20);
        label.setFont(font);
        //多次重复调用
        //label.setFont(Font.loadFont("https://db.onlinewebfonts.com/t/0ed964b46cdfeeff9e07717b9285bd7f.ttf",12));
        //改变字体大小
        label.setFont(Font.font(font.getFamily(),12));

        primaryStage.setScene(new Scene(new BorderPane( label), 500, 380));
        primaryStage.setTitle("Fx Web Font svg");
        primaryStage.show();
    }
}
